﻿using DigitalHealth.PACS.Appointment.Models;
using DigitalHealth.PACS.Appointment.Repositories;
using DigitalHealth.PACS.Common.Users;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace DigitalHealth.PACS.Appointment.Controllers
{
    /// <summary>
    /// 班次信息
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class ClassOrderController : ControllerBase
    {
        private IClassOrderRepository _classOrderRepository;

        public ClassOrderController(IClassOrderRepository classOrderRepository)
        {
            _classOrderRepository = classOrderRepository;
        }

        // GET: api/<ClassOrderController>
        [HttpGet]
        public IEnumerable<string> Get()
        {
            System.Console.WriteLine("班次信息被请求了");
            return new string[] { "班次1", "班次2", "班次3", "班次4", "班次5", "班次6", "班次4" };
        }

        // GET api/<ClassOrderController>/5
        //[HttpGet("{id}")]
        //public string Get(int id)
        //{
        //    return "value";
        //}
        [HttpGet("Doctor/{id}")]
        public IEnumerable<ClassOrder> GetClassOrders(string id)
        {
            SysUser sysUser=new SysUser() { UserId=int.Parse(id),UserName="test1"};

            return _classOrderRepository.GetByPredicate(c => c.doctorUser.UserId == sysUser.UserId);
        }

        // POST api/<ClassOrderController>
        [HttpPost]
        public void Post([FromBody] string value)
        {
        }

        // PUT api/<ClassOrderController>/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody] string value)
        {
        }

        // DELETE api/<ClassOrderController>/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}
